﻿@namespace ThingsGateway.Components
@using BlazorComponent.I18n
@using Masa.Blazor
<MChip Class="@Class" Style="@Style" Color="@Color" TextColor="@TextColor" Ripple="false">
    <span class="btn">@Label</span>
</MChip>



@code {
    [Inject]
    I18n I18n { get; set; }

    /// <summary>
    /// Class
    /// </summary>
    [Parameter]
    public string Class { get; set; } = "";

    /// <summary>
    /// Style
    /// </summary>
    [Parameter]
    public string Style { get; set; } = "";

    /// <summary>
    /// Value
    /// </summary>
    [Parameter]
    public bool Value { get; set; }

    /// <summary>
    /// DisabledLabel
    /// </summary>
    [Parameter]
    public string DisabledLabel { get; set; }

    /// <summary>
    /// EnabledLabel
    /// </summary>
    [Parameter]
    public string EnabledLabel { get; set; }

    private string TextColor => Value ? "green" : "error";
    private string Color => Value ? "green-lighten" : "warning-lighten";
    private string Label => Value ? EnabledLabel ?? I18n.T("Enable") : DisabledLabel ?? I18n.T("Disable");
}